package com.xd.springboot.listener;

import com.xd.springboot.entity.User;
import com.xd.springboot.event.MyEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

//自定义监听
@Component
public class MyEventListener implements ApplicationListener<MyEvent> {

    private  static  final Logger log = LoggerFactory.getLogger(MyHttpSessionListener.class);
    @Override
    public void onApplicationEvent(MyEvent myEvent) {
        User user = myEvent.getUser();
        log.info("用户名：{}",user.getUsername());
    }
}
